package com.zheng.springcloud.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zheng.springcloud.auth.api.SysUserApi;
import com.zheng.springcloud.auth.domain.SysUserDTO;
import com.zheng.springcloud.common.Result;
/**
 * 
 * @Description: 用户Controller组件
 * @author: zhengchuanqing
 * @date: 2019年3月6日 下午11:57:21
 * @throws
 */
@RestController
@RequestMapping("/user")
public class SysUserController{
    @Autowired
    private SysUserApi sysUserApi;
    /**
     * 
     * @Description: 查询用户 
     * @author: zhengchuanqing
     * @date: 2019年3月6日 下午11:57:21
     * @param: 
     * @return: Result<SysUserDTO>
     * @throws
     */
    @GetMapping("/getSysUser")
    public Result<SysUserDTO> getSysUser() {
    	Result<SysUserDTO> result = sysUserApi.getSysUser(100L);
        return result;
    } 
    /**
     * 
     * @Description: 保存用户 
     * @author: zhengchuanqing
     * @date: 2019年3月6日 下午11:57:21
     * @param: 
     * @return: Result<SysUserDTO>
     * @throws
     */
    @PostMapping("/saveSysUser")
    public Result<SysUserDTO> saveSysUser(HttpServletRequest request) {
    	SysUserDTO sysUserDTO = new SysUserDTO();
    	sysUserDTO.setUserName("wangwu");
    	sysUserDTO.setUserPwd("111111");
    	sysUserDTO.setNickName("王五");
        Result<SysUserDTO> result = sysUserApi.saveSysUser(sysUserDTO);
        return result;
    }
}
